home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / kbd / A20 / xfix-286mode2 < prev   
Encoding:
Text File  |  2008-03-13  |  3.9 KB  |  144 lines

  1.  
  2. The following is edited from several messages from Kees Bot dated May 4
  3. and 5, 1998. 
  4.  
  5. From: Kees J Bot <kjb=731391@CS.VU.NL>
  6. Subject: Re: 286 protected mode patch
  7.  
  8. Below is a patch to klib88.s for the changes I made after I got hold of
  9. HIMEM.ASM, a somewhat old source of HIMEM.SYS.  The A20 en/disable code
  10. is a bit better for the AT, and I also added code to en/disable the A20
  11. line for a PC with an MCA bus, i.e.  most PS/2's.
  12.  
  13. So if any of you is running 16-bit Minix on a machine with an MCA bus
  14. then this may be for you to get rid of processor=86.  
  15.  
  16. The PS/2 side of the patch is the great unknown, since I don't have a
  17. PS/2 to test it on.  Who knows, maybe someone will tell us if it works
  18. this time.
  19.  
  20. Apply the patch like this:
  21.     cd /usr/src/kernel
  22.     patch klib88.s klib88.dif
  23.     cd ../tools
  24.     make hdboot
  25.     shutdown -x 'unset processor;boot'
  26.  
  27. [Please note that this is experimental, there is another patch in this
  28. directory that attempts to solve the same problems.  Neither may be
  29. correct for every machine. -- asw 12.06.98]
  30. _._. .._ _   ._ ._.. ___ _. __.   _ .... .   _.. ___ _ _ . _..   ._.. .. _. .
  31. *** /save/std/2.0.0/src/kernel/klib88.s    Wed Jul 10 20:17:12 1996
  32. --- klib88.s    Mon May 04 12:20:59 1998
  33. ***************
  34. *** 72,75 ****
  35. --- 72,76 ----
  36.   .extern    _vid_mask
  37.   .extern    _level0_func
  38. + .extern    _ps_mca
  39.   
  40.       .text
  41. ***************
  42. *** 201,205 ****
  43.       ltr    ax            ! set TSS register
  44.   
  45. !     movb    ah, #0xDF
  46.       jmp    gate_A20        ! enable the A20 address line
  47.   
  48. --- 202,206 ----
  49.       ltr    ax            ! set TSS register
  50.   
  51. !     movb    ah, #0x02
  52.       jmp    gate_A20        ! enable the A20 address line
  53.   
  54. ***************
  55. *** 214,224 ****
  56.       jae    p2r386
  57.   p2r286:
  58. !     mov    _gdt+ES_286_OFFSET+DESC_BASE, #0x0400
  59.       movb    _gdt+ES_286_OFFSET+DESC_BASE_MIDDLE, #0x00
  60.       mov    ax, #ES_286_SELECTOR
  61.       mov    es, ax            ! BIOS data segment
  62. !   eseg    mov    0x0067, #real        ! set return from shutdown address
  63.     cseg    mov    ax, kernel_cs
  64. !   eseg    mov    0x0069, ax
  65.       movb    al, #0x8F
  66.       outb    0x70            ! select CMOS byte 0x0F (disable NMI)
  67. --- 215,225 ----
  68.       jae    p2r386
  69.   p2r286:
  70. !     mov    _gdt+ES_286_OFFSET+DESC_BASE, #0x0000
  71.       movb    _gdt+ES_286_OFFSET+DESC_BASE_MIDDLE, #0x00
  72.       mov    ax, #ES_286_SELECTOR
  73.       mov    es, ax            ! BIOS data segment
  74. !   eseg    mov    0x0467, #real        ! set return from shutdown address
  75.     cseg    mov    ax, kernel_cs
  76. !   eseg    mov    0x0469, ax
  77.       movb    al, #0x8F
  78.       outb    0x70            ! select CMOS byte 0x0F (disable NMI)
  79. ***************
  80. *** 254,273 ****
  81.       mov    sp, save_sp        ! restore stack
  82.   
  83. !     movb    ah, #0xDD
  84.       !jmp    gate_A20        ! disable the A20 address line
  85.   
  86. ! ! Enable (ah = 0xDF) or disable (ah = 0xDD) the A20 address line.
  87.   gate_A20:
  88.       call    kb_wait
  89.       movb    al, #0xD1    ! Tell keyboard that a command is coming
  90.       outb    0x64
  91.       call    kb_wait
  92. !     movb    al, ah        ! Enable or disable code
  93.       outb    0x60
  94.       call    kb_wait
  95. !     mov    ax, #25        ! 25 microsec delay for slow keyboard chip
  96. ! 0:    out    0xED        ! Write to an unused port (1us)
  97. !     dec    ax
  98. !     jne    0b
  99.       ret
  100.   kb_wait:
  101. --- 255,276 ----
  102.       mov    sp, save_sp        ! restore stack
  103.   
  104. !     xorb    ah, ah
  105.       !jmp    gate_A20        ! disable the A20 address line
  106.   
  107. ! ! Enable (ah = 0x02) or disable (ah = 0x00) the A20 address line.
  108.   gate_A20:
  109. +     cmp    _ps_mca, #0    ! PS/2 bus?
  110. +     jnz    gate_PS_A20
  111.       call    kb_wait
  112.       movb    al, #0xD1    ! Tell keyboard that a command is coming
  113.       outb    0x64
  114.       call    kb_wait
  115. !     movb    al, #0xDD    ! 0xDD = A20 disable code if ah = 0x00
  116. !     orb    al, ah        ! 0xDF = A20 enable code if ah = 0x02
  117.       outb    0x60
  118.       call    kb_wait
  119. !     movb    al, #0xFF    ! Pulse output port
  120. !     outb    0x64
  121. !     call    kb_wait        ! Wait for the A20 line to settle down
  122.       ret
  123.   kb_wait:
  124. ***************
  125. *** 275,278 ****
  126. --- 278,293 ----
  127.       testb    al, #0x02    ! Keyboard input buffer full?
  128.       jnz    kb_wait        ! If so, wait
  129. +     ret
  130. + gate_PS_A20:        ! The PS/2 can twiddle A20 using port A
  131. +     inb    0x92        ! Read port A
  132. +     andb    al, #0xFD
  133. +     orb    al, ah        ! Set A20 bit to the required state
  134. +     outb    0x92        ! Write port A
  135. +     jmp    .+2        ! Small delay
  136. + A20ok:    inb    0x92        ! Check port A
  137. +     andb    al, #0x02
  138. +     cmpb    al, ah        ! A20 line settled down to the new state?
  139. +     jne    A20ok        ! If not then wait
  140.       ret
  141.   
  142.  
  143.